﻿using Framework.Common;
using Framework.Entity;
using BridgeShips.AI;
using UnityEngine;

namespace BridgeShips {
    public class VehicleEntity : EntityBase ,IEntity {

        private uint m_id = 0;
        private int  m_type = 0;
        private uint m_location = 0;
        private uint m_signature = 0;
        private GameObject m_Obj = null;

        public bool IsShow {
            get; set;
        }

        public int Priority { get; set; }

        public uint GetID() {
            return ID;
        }
        public uint ID {
            get {
                return m_id;
            }
            set {
                m_id = value;
            }
        }
        public int GetVehicleType() {
            return TYPE;
        }
        public int TYPE {
            get {
                return m_type;
            }
            set {
                m_type = value;
            }
        }
        //tell 
        public int m_Locate = 0;

        public GameObject Get() {
            return m_Obj;
        }

        public AIShip GetAI() {
            return m_Obj.GetComponentInParent<AIShip>();
        }

        public Vector3 Position() {
            return Transform().position;
        }

        public int GetLocateFlag() {
            return m_Locate;
        }
        public void LocateFlag( int index ) {
            m_Locate = index;
        }

        private uint  HashCode()  {
	        return (uint) (((uint)m_signature << 32) | (uint)m_location);
        }

        public void Grap(uint id,GameObject obj, int type ) {
            ID = id;
            m_Obj = obj;
        }

        public void OnHide() {

        }

        public Transform Transform() {
            return m_Obj.transform;
        }

        public void OnRelease() {

        }

        public void OnShow() {

        }

        public void OnStart() {

        }

        public void OnUpdate( float frameTime, float realTime ) {
            //OnShipMove( ReceivedPos );
        }

    }
}